mudbox::Kernel Class Reference

#include <kernel.h>

Inheritance diagram for mudbox::Kernel:

Inheritance graph
[legend]
List of all members.

Detailed Description

The main API access point to Mudbox, contains the most basic functions and data.

There is exactly one Kernel object, you use the Kernel() global function to access it.


Public Types

enum   MessageBoxType { msgInformation, msgWarning, msgQuestion, msgError }
enum   MessageBoxButton {
  buttonNone = 0x00000000, buttonOk = 0x00000400, buttonCancel = 0x00400000, buttonClose = 0x00200000,
  buttonYes = 0x00004000, buttonYesToAll = 0x00008000, buttonNo = 0x00010000, buttonNoToAll = 0x00020000,
  buttonAbort = 0x00040000, buttonRetry = 0x00080000, buttonIgnore = 0x00100000, buttonHelp = 0x01000000
}
enum   HUDMessageType { HUDmsgPin, HUDmsgFade }
enum   StatusType { stNormal, stWarning, stError }
enum   SceneRenderMode {
  srmNormal = 0, srmFlatTexturesOnBlack, srmFlatTexturesOnWhite, srmFlatNoTextures,
  srmNoTextures
}
  Describes how to render the scene off-screen with RenderScene. More...

Public Member Functions

virtual const mudbox::ClassDesc RuntimeClass (void) const
  Kernel (void)
  Constructor. There is exactly one kernel in Mudbox, so you should never try to create one.
void  Log (const char *pMessage,...)
  Writes a message to Mudbox's internal log.
void  LogMemoryStatus (bool bCompact=true)
  Logs the current memory status. For debugging purposes only.
void  LogMemoryBlocks (float fSizeLimit=0.01)
  Logs current memory blocks (which are used by the Store class).
int  MessageBox (MessageBoxType iType, const QString &sTitle, const QString &sText, int iButtons=buttonNone, int iDefaultButton=buttonNone)
  Displays a modal message box to the user.
void  HUDMessageShow (const QString &sMessage, HUDMessageType iType)
  Displays a message as text overlay (HUD) in the 3d view.
void  HUDMessageHide ()
  Hides a text overlay (HUD) message created with a call to HUDMessageShow().
void  SetStatus (StatusType iType, const QString &sMsg)
  Display a message in the status bar, which is on the bottom edge of the Mudbox window.
void  AddClassMenuItem (const QString &sMenu, const QString &sSubmenu, const ClassDesc *pClass, const QString &sCreatorText, const int &index=-1)
  Adds a new submenu to the interface that can be used to create and edit instances of a class you define in your plug-in.
void  AddCallbackMenuItem (const QString &sMenu, const QString &sSubmenu, const QString &sItemName, void(*pCallback)(), const int &index=-1)
  Adds a new menu item that calls a callback function you specify in your plug-in.
Mesh CreateMesh (Topology::FaceType eType)
  Creates an empty mesh object and returns a pointer to it.
void  ProgressStart (const QString &sDescription, unsigned int iMaxValue)
  Displays a progress bar, to show a process beginning. This will set the current progess value to 0.
void  ProgressSet (unsigned int iValue)
  Updates the current progress bar.
void  ProgressAdd (void)
  Updates the current progress bar by adding one to the progress value used.
void  ProgressEnd (void)
  Removes the current progress bar, whether or not the process is complete.
bool  ProgressIsCancelRequested (void)
  Returns true if the user cancelled an operation in progress.
QString  LoadFileDialog (const QString &sTitle, const QString &sPath, const QString &sFilter) const
  Opens a modal file dialog so the user can choose an existing file to open. Returns the path to the file.
QString  SaveFileDialog (const QString &sTitle, const QString &sPath, const QString &sFilter, bool bAskForOverwrite=true, QString *sSelectedFilter=0) const
  Opens a modal file dialog so the user can choose a file name to save to. Returns the path to the file.
void  WaitCursorStart (void)
  Show the wait cursor.
void  WaitCursorEnd (void)
  Restore the previous cursor after calling WaitCursorStart().
void  RecordCommand (const char *sCommand,...)
  Records a command to the mudbox automation file.
Scene CreateDefaultScene (void)
  Creates a default mudbox scene and returns it.
const ClassDesc PreferredDescendant (const ClassDesc *pClass) const
  Returns the 'preferred descendant' of a public interface, which must be used to create instances.
Node CreateClassInstance (const ClassDesc *pClass) const
  Creates an instance of the preferred descendant of an interface class.
Image LoadImage (const QString &sFileName) const
  Creates a new image instance, loads a file to it, and returns the pointer.
void  GLCheckError (const char *sSourceFileName, const char *sFunctionName, unsigned int iLine) const
  Checks to see if there was an OpenGL error, and writes it to the mudbox log. Used for debugging.
void  GLCheckStates (const char *sSourceFileName, const char *sFunctionName, unsigned int iLine) const
  Checks if the opengl states are all set to their default values, and writes the result to the Mudbox log. Used for debugging.
void  Redraw (void)
  Forces a full refresh of the 3d viewport.
Scene Scene (void) const
  Returns a pointer to the current scene.
mudbox::Preferences Preferences (void) const
  Returns a pointer to the preferences.
mudbox::Interface Interface (void) const
  Returns a pointer to the interface.
Statistics Statistics (void) const
  Returns a pointer to the program statistics.
ViewPort ViewPort (void) const
  Returns a pointer to the current viewport.
QWidget *  MainWindow (void) const
  Returns a pointer to the main window.
void  AddView (QString className, QString windowTitle, const bool select=false) const
  Adds a view in the central widget.
void  RegisterWindowPlugin (WindowPlugin *plugin) const
  Registers the Mudbox Community web browser.
mudbox::TrayAccessor TrayAccessor (void) const
  Returns a pointer to the tray accessor.
bool  ExtractArchiveFile (QString sArchiveFilePath, QString sDestPath)
  Extracts an archived file to destination.
bool  CreateArchiveFile (QString sArchiveFilePath, QStringList files)
void  AddToCreateMeshMenu (QFileInfo fileInfo)
  Adds a mesh to the Create->Mesh menu.
QString  ApplicationDirectory (void) const
  Returns the path to where the Mudbox application is installed.
QString  ProjectFilesDirectory (void) const
  Returns the path of the project files.
QString  SafeWritableDirectory (void) const
  Returns the root path to where the application can safely write files.
QString  PluginDirectory (const QString &pluginName) const
  Returns the path from which the specified plugin was loaded.
bool  IsTestModeOn (void) const
  Returns true if the application is in testing mode (i.e.
void  RefreshUI (void) const
  Refresh all dialogs.
Image RenderScene (const QString &sChannel, int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true)
  Renders the scene, and returns it in an image.
Image RenderScene (int iWidth, int iHeight, SceneRenderMode renderMode, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true)
  Renders the scene, and returns it in an image.
Image RenderScene (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=true) const
  Renders the scene, including background and post-process filters, and returns it in an image.
Image ExtractUnprojectedTextures (const QString &sChannel, int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
  Creates a 4 channel image containing the unprojected textures of the scene using the current camera position and settings.
Image ExtractUnprojectedTextures (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
Image ExtractShadingMap (int iWidth, int iHeight, enum Image::Format fmt=Image::e8integer, bool bTiledImg=false)
  Creates a 4 channel image containing the shading of the scene using the current camera position and settings.
int  ViewportWidth () const
  Returns the current width of the viewport in pixels.
int  ViewportHeight () const
  Returns the current height of the viewport in pixels.
void  ReportVideoMemoryUsage (int64 iSize)
  Informs the kernel of video memory usage changes.
int64  VideoMemoryUsage (void) const
  Returns the total amount of video memory currently in use in bytes.
bool  DoOperation (Operation *pOp, bool bMerge=false)
  This function executes an operation and makes it possible to undo/redo the operation later.
QString  TriggerFileEvent (FileEvent::Type eType, const QString &sFileName) const
  Trigger a file event. The returned filepath can be different than the one passed as parameter.

Static Public Member Functions

const mudbox::ClassDesc StaticClass (void)
mudbox::Node CreateInstances (unsigned int iCount=1)

Public Attributes

astring  m_sNextCommand
  This attribute always contains the next command. Plugins can link their own attribute to this one, and can process commands this way. See RecordCommand().
aevent  m_eFrame
  This event is triggered when a new frame is displayed on the viewport. See the class EventGate for more details.
aevent  m_eEndRender
  This event is triggered when rendering a new image of the scene is finished. See the class EventGate for more details.
aevent  m_eLowMemory
  This event is triggered when the memory status gets critical.
aevent  m_eRestoreMemory
  This event is triggered when memory status is no longer critical.
aevent  m_ePostRender
  This event is triggered at the end of rendering the scene into a rendertarget.
aptr< FileEvent m_pFileEvent
  This is a pointer to the latest file event.
aptr< KeyboardEvent m_pKeyboardEvent
  This is a pointer to the latest keyboard event.
aptr< Node m_pSelectedNode
  This pointer contains the address of the currently selected node in the scene.
aptr< BrushOperation m_pSelectedBrush
  This pointer contains the address of the currently selected brush.

Member Enumeration Documentation

enum mudbox::Kernel::MessageBoxType
 
Enumeration values:
msgInformation 
msgWarning 
msgQuestion 
msgError 
00070     {
00071         msgInformation,
00072         msgWarning,
00073         msgQuestion,
00074         msgError
00075     };
enum mudbox::Kernel::MessageBoxButton
 
Enumeration values:
buttonNone 
buttonOk 
buttonCancel 
buttonClose 
buttonYes 
buttonYesToAll 
buttonNo 
buttonNoToAll 
buttonAbort 
buttonRetry 
buttonIgnore 
buttonHelp 
00077     {
00078         buttonNone      = 0x00000000,
00079         buttonOk        = 0x00000400,
00080         buttonCancel    = 0x00400000,
00081         buttonClose     = 0x00200000,
00082         buttonYes       = 0x00004000,
00083         buttonYesToAll  = 0x00008000,
00084         buttonNo        = 0x00010000,
00085         buttonNoToAll   = 0x00020000,
00086         buttonAbort     = 0x00040000,
00087         buttonRetry     = 0x00080000,
00088         buttonIgnore    = 0x00100000,
00089         buttonHelp      = 0x01000000
00090     };
enum mudbox::Kernel::HUDMessageType
 
Enumeration values:
HUDmsgPin  keep the HUD message up until specifically cancelled
HUDmsgFade  make the message fade away after a few seconds
00092     {
00093         HUDmsgPin,      
00094         HUDmsgFade      
00095     };
enum mudbox::Kernel::StatusType
 
Enumeration values:
stNormal  message
stWarning  warning
stError  error
00098     {
00099         stNormal,       
00100         stWarning,      
00101         stError         
00102     };
enum mudbox::Kernel::SceneRenderMode
 

Describes how to render the scene off-screen with RenderScene.

Enumeration values:
srmNormal  Renders the scene as it would appear in the interactive viewport.
srmFlatTexturesOnBlack  flat shaded, textures on black material background, no grids, curves or background
srmFlatTexturesOnWhite  flat shaded, textures on white material background, no grids, curves or background
srmFlatNoTextures  flat shaded, no textures, grids, curves or background
srmNoTextures  flat shading off, textures off, no grids, curves or background
00399                          {
00400         srmNormal = 0,          
00401         srmFlatTexturesOnBlack, 
00402         srmFlatTexturesOnWhite, 
00403         srmFlatNoTextures,      
00404         srmNoTextures           
00405     };

Constructor & Destructor Documentation

mudbox::Kernel::Kernel void   ) 
 

Constructor. There is exactly one kernel in Mudbox, so you should never try to create one.


Member Function Documentation

virtual const mudbox::ClassDesc* mudbox::Kernel::RuntimeClass void   )  const [inline, virtual]
 

Reimplemented from mudbox::Node.

00068 :
    enum MessageBoxType
const mudbox::ClassDesc* mudbox::Kernel::StaticClass void   )  [static]
 

Reimplemented from mudbox::Node.

mudbox::Node* mudbox::Kernel::CreateInstances unsigned int  iCount = 1  )  [static]
 

Reimplemented from mudbox::Node.

void mudbox::Kernel::Log const char *  pMessage,
  ...
 

Writes a message to Mudbox's internal log.

The log can be viewed inside Mudbox in the "log" view, or by readin the mudbox.log file written by the application. (located at your documents/Mudbox/2009/data/Logs/mudbox.log on windows)

This method takes the same arguments as the standard printf call, allowing you to easily format your data.

void mudbox::Kernel::LogMemoryStatus bool  bCompact = true  ) 
 

Logs the current memory status. For debugging purposes only.

Parameters:
bCompact  [in] If true, write the status in a more compact form.
void mudbox::Kernel::LogMemoryBlocks float  fSizeLimit = 0.01  ) 
 

Logs current memory blocks (which are used by the Store class).

Blocks smaller than fSizeLimit*(largest block size) will not be logged. This call is mostly used to detect memory leaks.

Parameters:
fSizeLimit  [in] Specifies the minimum size of block that will be logged (this value times the largest block)
int mudbox::Kernel::MessageBox MessageBoxType  iType,
const QString &  sTitle,
const QString &  sText,
int  iButtons = buttonNone,
int  iDefaultButton = buttonNone
 

Displays a modal message box to the user.

Parameters:
iType  [in] One of Kernel::msgInformation, Kernel::msgWarning, Kernel::msgQuestion or Kernel::msgError
sTitle  [in] The title of the message box
sText  [in] The text of the message
iButtons  [in] The buttons to include. Specify this as a bitwise OR of the available MessageBoxButton flags.
iDefaultButton  [in] Specifies which of the buttons should be the default when the window opens
void mudbox::Kernel::HUDMessageShow const QString &  sMessage,
HUDMessageType  iType
 

Displays a message as text overlay (HUD) in the 3d view.

You can specify if the message is temporary (fading after a few seconds) or if it should stay "pinned" on the screen until overwritten or dismissed with HUDMessageHide(). New messages will replace previous ones.

Parameters:
sMessage  [in] The text of the message (may include some HTML tags, such as for bold or italics)
iType  [in] One of Kernel::HUDmsgPin or Kernel::HUDmsgFade
void mudbox::Kernel::HUDMessageHide  ) 
 

Hides a text overlay (HUD) message created with a call to HUDMessageShow().

Note: if a message was displayed with the Kernel::HUDmsgFade parameter, then it will go away after a few seconds with no intervention.

void mudbox::Kernel::SetStatus StatusType  iType,
const QString &  sMsg
 

Display a message in the status bar, which is on the bottom edge of the Mudbox window.

Parameters:
iType  [in] Determines the color of the message. One of Kernel::stNormal, Kernel::stWarning, or Kernel::stError
sMsg  [in] The text of the message
void mudbox::Kernel::AddClassMenuItem const QString &  sMenu,
const QString &  sSubmenu,
const ClassDesc pClass,
const QString &  sCreatorText,
const int &  index = -1
 

Adds a new submenu to the interface that can be used to create and edit instances of a class you define in your plug-in.

For example, if you call:

            Kernel()->AddClassMenuItem( "Maps", "MyItem", myClass::StaticClass(), "Make New Instance" );
A new submenu (named "MyItem") will be added to the end of the "Maps" menu. This new submenu will initially contain one item, called "Make New Instance". If you select this item, a new instance of myClass will be created, and an editor opened for it so you can change its values. The name of the new instance will also be added to the "MyItem" submenu, so that you can go back and edit it later.

Note that "StaticClass()" is automatically defined for any class that uses the IMPLEMENT_CLASS macro.

Parameters:
sMenu  [in] The name of the menu to which your sub-menu will be added.
sSubmenu  [in] The name of the sub-menu to be created
pClass  [in] The class to be created by the new menu item
sCreatorText  [in] The name of the menu item that will create your new class
index  [in] The index where you want to insert the new menu, -1 means append to the end of menu
void mudbox::Kernel::AddCallbackMenuItem const QString &  sMenu,
const QString &  sSubmenu,
const QString &  sItemName,
void(*)()  pCallback,
const int &  index = -1
 

Adds a new menu item that calls a callback function you specify in your plug-in.

The signature of your callback function must be:

            void myCallback();
Parameters:
sMenu  [in] The name of the menu to which the item should be added
sSubmenu  [in] The name of a submenu to which the item should be added (if you don't want a submenu, pass in an empty QString)
sItemName  [in] The name of the new menu item that will call your callback
pCallback  [in] A pointer to the callback function
index  [in] The index where you want to insert the new menu, -1 means append to the end of menu
Mesh* mudbox::Kernel::CreateMesh Topology::FaceType  eType  ) 
 

Creates an empty mesh object and returns a pointer to it.

Mesh objects must be entirely triangles, or entirely quads.

Parameters:
eType  [in] The mesh type, one of Topology::typeTriangular or Topology::typeQuadric
void mudbox::Kernel::ProgressStart const QString &  sDescription,
unsigned int  iMaxValue
 

Displays a progress bar, to show a process beginning. This will set the current progess value to 0.

Parameters:
sDescription  [in] A name or description for the process whose progress is being shown
iMaxValue  [in] A positive value representing the completion of the process
void mudbox::Kernel::ProgressSet unsigned int  iValue  ) 
 

Updates the current progress bar.

Parameters:
iValue  [in] The new progress value (the maximum allowed value was specified in ProgressStart() )
void mudbox::Kernel::ProgressAdd void   ) 
 

Updates the current progress bar by adding one to the progress value used.

void mudbox::Kernel::ProgressEnd void   ) 
 

Removes the current progress bar, whether or not the process is complete.

bool mudbox::Kernel::ProgressIsCancelRequested void   ) 
 

Returns true if the user cancelled an operation in progress.

When a progress bar is displayed, the user can cancel out of the operation in progress by clicking the cancel button, or by hitting the ESC key. If your plug-in is running a long process with a progress bar showing, it should call this method regularly to see if the user has cancelled the operation.

QString mudbox::Kernel::LoadFileDialog const QString &  sTitle,
const QString &  sPath,
const QString &  sFilter
const
 

Opens a modal file dialog so the user can choose an existing file to open. Returns the path to the file.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
sTitle  [in] The title to display in the file dialog
sPath  [in] The initial path to display when the file dialog opens
sFilter  [in] A QString that specifies which kind of files should be displayed. For example: "TIFF images (*.tif);;PNG images (*.png)"
QString mudbox::Kernel::SaveFileDialog const QString &  sTitle,
const QString &  sPath,
const QString &  sFilter,
bool  bAskForOverwrite = true,
QString *  sSelectedFilter = 0
const
 

Opens a modal file dialog so the user can choose a file name to save to. Returns the path to the file.

If the user cancels out of the file dialog, an empty QString is returned.

Parameters:
sTitle  [in] The title to display in the file dialog
sPath  [in] The initial path to display when the file dialog opens
sFilter  [in] A string that filters which kind of files should be displayed. For example: "TIFF images (*.tif);;PNG images (*.png)"
bAskForOverwrite  [in] If true, when the user chooses an existing file, he will be asked if he wants to overwrite it.
sSelectedFilter  [in] The filter that should be used by default
void mudbox::Kernel::WaitCursorStart void   ) 
 

Show the wait cursor.

void mudbox::Kernel::WaitCursorEnd void   ) 
 

Restore the previous cursor after calling WaitCursorStart().

void mudbox::Kernel::RecordCommand const char *  sCommand,
  ...
 

Records a command to the mudbox automation file.

As commands are executed in Mudbox, it records them into an automation file so that they can be played back later, usually for testing or debugging purposes. If you want your plugin actions to be recorded, call this method to record what it did. The format of this recordins should be a unique name for the command, followed by a list of arguments.

Note: this method takes the same arguments as standard printf, making it easy to specify arguments in your call.

If you record your plugin commands, then you also need to be able to play them back from your recording. To do this, define a variable of type astring in your plugin, and connect it to the m_sNextCommand variable of the Kernel, which always contains the string value of the next command to be performed. This connection is done like this:

            astring myNextCommand;
            ...
            myNextCommand.Connect( Kernel()->m_sNextCommand );
Once you have done this, myNextCommand will change every time the variable in the Kernel changes, and you can capture that even to see if it is your command string. If it is, you run the command like this:
            void myClass::OnNodeEvent( const Attribute &cAttribute, NodeEventType eType )
            {
                if ( eType == etValueChanged && cAttribute == myNextCommand )
                {
                    // get the first word in the command
                    String sOperation = myNextCommand.Value().Section( ' ', 0 ); 
                    if ( sOperation == "myCommandName" ){
                        ...get arguments and process your command here
class Scene* mudbox::Kernel::CreateDefaultScene void   ) 
 

Creates a default mudbox scene and returns it.

const ClassDesc* mudbox::Kernel::PreferredDescendant const ClassDesc pClass  )  const
 

Returns the 'preferred descendant' of a public interface, which must be used to create instances.

In the mudbox SDK you will find lots of interfaces defined without any functionality, such as Texture and Image. Plugins can implement these interfaces by defining their own classes inherited from an SDK interface. When the functionality is needed somewhere, then this function can tell you what the best available implementation is. You can then create one instance of that class and access the functionality you need. You should use the CreateInstance() global templated function to create those object. (It uses PreferredDescendant() internally, but provides a more comfortable way to access those functionalities.)

Node* mudbox::Kernel::CreateClassInstance const ClassDesc pClass  )  const
 

Creates an instance of the preferred descendant of an interface class.

See PreferredDescendant() for more details. We recommend using the CreateInstance() global function instead of this.

Image* mudbox::Kernel::LoadImage const QString &  sFileName  )  const
 

Creates a new image instance, loads a file to it, and returns the pointer.

It is the responsibility of the caller to delete the returned Image.

/b Note: This function will be removed from future releases of the SDK.

Parameters:
sFileName  [in] Path of the image file to be opened.
void mudbox::Kernel::GLCheckError const char *  sSourceFileName,
const char *  sFunctionName,
unsigned int  iLine
const
 

Checks to see if there was an OpenGL error, and writes it to the mudbox log. Used for debugging.

Parameters:
sSourceFileName  [in] The name of the file where this is being called
sFunctionName  [in] The name of the function from which this is being called
iLine  [in] The line number where this is being called
void mudbox::Kernel::GLCheckStates const char *  sSourceFileName,
const char *  sFunctionName,
unsigned int  iLine
const
 

Checks if the opengl states are all set to their default values, and writes the result to the Mudbox log. Used for debugging.

Parameters:
sSourceFileName  [in] The name of the file where this is being called
sFunctionName  [in] The name of the function from which this is being called
iLine  [in] The line number where this is being called
void mudbox::Kernel::Redraw void   ) 
 

Forces a full refresh of the 3d viewport.

This function is obsolete, use ViewPort::Redraw instead.

class Scene* mudbox::Kernel::Scene void   )  const
 

Returns a pointer to the current scene.

mudbox::Preferences* mudbox::Kernel::Preferences void   )  const
 

Returns a pointer to the preferences.

class mudbox::Interface* mudbox::Kernel::Interface void   )  const
 

Returns a pointer to the interface.

class Statistics* mudbox::Kernel::Statistics void   )  const
 

Returns a pointer to the program statistics.

class ViewPort* mudbox::Kernel::ViewPort void   )  const
 

Returns a pointer to the current viewport.

QWidget* mudbox::Kernel::MainWindow void   )  const
 

Returns a pointer to the main window.

void mudbox::Kernel::AddView QString  className,
QString  windowTitle,
const bool  select = false
const
 

Adds a view in the central widget.

void mudbox::Kernel::RegisterWindowPlugin WindowPlugin plugin  )  const
 

Registers the Mudbox Community web browser.

mudbox::TrayAccessor* mudbox::Kernel::TrayAccessor void   )  const
 

Returns a pointer to the tray accessor.

bool mudbox::Kernel::ExtractArchiveFile QString  sArchiveFilePath,
QString  sDestPath
 

Extracts an archived file to destination.

bool mudbox::Kernel::CreateArchiveFile QString  sArchiveFilePath,
QStringList  files
 
void mudbox::Kernel::AddToCreateMeshMenu QFileInfo  fileInfo  ) 
 

Adds a mesh to the Create->Mesh menu.

QString mudbox::Kernel::ApplicationDirectory void   )  const
 

Returns the path to where the Mudbox application is installed.

QString mudbox::Kernel::ProjectFilesDirectory void   )  const
 

Returns the path of the project files.

QString mudbox::Kernel::SafeWritableDirectory void   )  const
 

Returns the root path to where the application can safely write files.

QString mudbox::Kernel::PluginDirectory const QString &  pluginName  )  const
 

Returns the path from which the specified plugin was loaded.

bool mudbox::Kernel::IsTestModeOn void   )  const
 

Returns true if the application is in testing mode (i.e.

was started with the -test command line parameter).

void mudbox::Kernel::RefreshUI void   )  const
 

Refresh all dialogs.

Image* mudbox::Kernel::RenderScene const QString &  sChannel,
int  iWidth,
int  iHeight,
SceneRenderMode  renderMode,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true
 

Renders the scene, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
sChannel  [in] the name of the channel to render
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
renderMode  describes variations on how to render the scene.
fmt  [in] Desired image format.
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
Image* mudbox::Kernel::RenderScene int  iWidth,
int  iHeight,
SceneRenderMode  renderMode,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true
 

Renders the scene, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

You can also describe a render mode -- the different render modes can be used together to extract unprojected textures or extract shading/shadow information.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
renderMode  describes variations on how to render the scene.
fmt  [in] Desired image format.
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
Image* mudbox::Kernel::RenderScene int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = true
const
 

Renders the scene, including background and post-process filters, and returns it in an image.

Does not include extra things like the HUD or the cursor ring. Returns a pointer to an image object that the scene was rendered into. You can specify the desired size for the rendering, or leave the input variables set to 0 to render at the current screen resolution.

currently only 8 bit images are supported by this operation Note: Once the image is returned, it is your responsibility to delete it when you are done with it.

Parameters:
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
fmt  [in] Desired image format.
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
Image* mudbox::Kernel::ExtractUnprojectedTextures const QString &  sChannel,
int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false
 

Creates a 4 channel image containing the unprojected textures of the scene using the current camera position and settings.

The image will be rendered at the specified size, or if the specified width and height are 0, it will use the current viewport size. currently only 8 bit images are supported by this operation Resulting images currently must be untiled.

Parameters:
sChannel  [in] the name of the channel to render
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
fmt  [in] Desired image format. Currently must be e8integer
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
Image* mudbox::Kernel::ExtractUnprojectedTextures int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false
 
Parameters:
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
fmt  [in] Desired image format. Currently must be e8integer
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
Image* mudbox::Kernel::ExtractShadingMap int  iWidth,
int  iHeight,
enum Image::Format  fmt = Image::e8integer,
bool  bTiledImg = false
 

Creates a 4 channel image containing the shading of the scene using the current camera position and settings.

The image will be rendered at the specified size, or if the specified width and height are 0, it will use the current viewport size. The result of this image, blended over a flat shaded version of the scene will appear as though the shading and shadowing were turned on. currently only 8 bit images are supported by this operation Resulting images currently must be untiled.

Parameters:
iWidth  [in] The width of the rendering in pixels. Set to 0 to use current screen size.
iHeight  [in] The height of the rendering in pixels. Set to 0 to use current screen size.
fmt  [in] Desired image format. Currently must be e8integer
bTiledImg  [in] hint -- true if the resulting image is to be tiled, false if contiguous.
int mudbox::Kernel::ViewportWidth  )  const
 

Returns the current width of the viewport in pixels.

int mudbox::Kernel::ViewportHeight  )  const
 

Returns the current height of the viewport in pixels.

void mudbox::Kernel::ReportVideoMemoryUsage int64  iSize  ) 
 

Informs the kernel of video memory usage changes.

When a plugin allocates or frees video memory, it should call this function to inform mudbox about the change. If it doesn't call this function, then Mudbox will not know how much video memory is available. This information is used to optimize some operations. When video memory is deallocated, the iSize parameter should be negative.

Parameters:
iSize  [in] The amount of video memory memory used (positive numbers) or released (negative numbers) in bytes
int64 mudbox::Kernel::VideoMemoryUsage void   )  const
 

Returns the total amount of video memory currently in use in bytes.

bool mudbox::Kernel::DoOperation Operation pOp,
bool  bMerge = false
 

This function executes an operation and makes it possible to undo/redo the operation later.

If a plugin wants an operation to be undoable, it must execute the operation using this function call.

See also:
mudbox::Operation
Parameters:
pOp  [in] Address of the operation which has to be executed.
bMerge  [in] When this parameter is true, this operation will be undone/redone in a common step with the previous one.
QString mudbox::Kernel::TriggerFileEvent FileEvent::Type  eType,
const QString &  sFileName
const
 

Trigger a file event. The returned filepath can be different than the one passed as parameter.

The mudbox kernel triggers file events every time when it: 1. About to open a file for reading 2. About to open a file for writing 3. Read a file 4. Wrote a file 5. About to let the user browse for a file to read 6. About to let the user browse for a file to write When a file operation happens in Mudbox, the events listed above are triggered. If your plugins reads or writes files, they should trigger the appropriate events by calling this method. The returned string is the filename, which is usually the same as the passed sFileName, but it might be modified by an entity that intercepted the file event.

Parameters:
eType  [in] One of FileEvent::typeBrowseForRead, FileEvent::typeBrowseForWrite, FileEvent::typePreRead, FileEvent::typePostRead, FileEvent::typePreWrite or FileEvent::typePostWrite
sFileName  [in] The filepath that is the intended target of the operation. This can be changed by whoever intercepts the event.

Member Data Documentation

astring mudbox::Kernel::m_sNextCommand
 

This attribute always contains the next command. Plugins can link their own attribute to this one, and can process commands this way. See RecordCommand().

aevent mudbox::Kernel::m_eFrame
 

This event is triggered when a new frame is displayed on the viewport. See the class EventGate for more details.

aevent mudbox::Kernel::m_eEndRender
 

This event is triggered when rendering a new image of the scene is finished. See the class EventGate for more details.

aevent mudbox::Kernel::m_eLowMemory
 

This event is triggered when the memory status gets critical.

Plugins should deallocate temporary buffers to help the situation. See the class EventGate for more details.

aevent mudbox::Kernel::m_eRestoreMemory
 

This event is triggered when memory status is no longer critical.

Plugins can allocate their temporary buffers and fill them with data if they wish. See the class EventGate for more details.

aevent mudbox::Kernel::m_ePostRender
 

This event is triggered at the end of rendering the scene into a rendertarget.

Plugins can use this event to render additional content to the rendertargets, like gizmos or ovelays. See the class EventGate for more details.

aptr<FileEvent> mudbox::Kernel::m_pFileEvent [mutable]
 

This is a pointer to the latest file event.

Plugins can use this pointer to catch file event. When a new file event is triggered, this pointer will change its value to the new file event. Plugins can also have their own pointer with the same type. At startup they can connect their pointer to this pointer in kernel by calling the Connect() function on their pointer. This means that when the m_pFileEvent pointer in kernel changes, their own pointer will also change. They can then catch this in their OnNodeEvent() function. Using this pointer to anything else than connecting an own pointer to it is forbidden.

aptr<KeyboardEvent> mudbox::Kernel::m_pKeyboardEvent [mutable]
 

This is a pointer to the latest keyboard event.

Plugins can use this pointer to catch and respond to keyboard events. When a new event occurs, the value of this pointer changes to a structure which describes the event. The class should have it's own instance of a pointer with the same type, which should be connected to this pointer using the Attribute::Connect() function. The class can then catch and respond any changes made to this variable in its the OnNodeEvent() function.

aptr<Node> mudbox::Kernel::m_pSelectedNode
 

This pointer contains the address of the currently selected node in the scene.

Plugins can connect their own pointers of the same type to this attribute to respond to selection related events.

See also:
Attribute::Connect().
aptr<BrushOperation> mudbox::Kernel::m_pSelectedBrush
 

This pointer contains the address of the currently selected brush.

Plugins can connect their own pointer of the same type to this attribute if they want to respond to brush activation events.

See also:
Attribute::Connect().

mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel
mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel mudbox::Kernel